package com.study.springsecurity;

import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;

import java.util.List;
import java.util.Map;

@Slf4j
@EnableGlobalMethodSecurity(prePostEnabled = true,securedEnabled = true, jsr250Enabled=true)
@SpringBootApplication
@MapperScan("com.study.springsecurity.mapper")
public class SpringSecurity03Application {
    // https://blog.csdn.net/Johnson_7/article/details/126936703
    // https://blog.csdn.net/weixin_43888891/article/details/124111885
    // https://blog.csdn.net/u012373815/article/details/77408306
    // https://blog.csdn.net/qq_25272679/article/details/108326762
    // https://blog.csdn.net/weixin_40379712/article/details/129927712
    // https://blog.csdn.net/weixin_55801899/article/details/136223513
    // https://www.cnblogs.com/taiyonghai/p/9402734.html
    // https://blog.csdn.net/liuminglei1987/article/details/107904526
    // https://blog.csdn.net/qq_43581790/article/details/124705401
    // 注解鉴权
    // https://blog.csdn.net/peng_gx/article/details/135610582
    // https://www.jianshu.com/p/9f1aab4440d2
    // https://huaweicloud.csdn.net/638f1219dacf622b8df8e7b6.html

    // 动态权限校验
    // https://www.cnblogs.com/felordcn/p/16167532.html
    public static void main(String[] args) {
        ConfigurableApplicationContext run = SpringApplication.run(SpringSecurity03Application.class, args);
        RequestMappingHandlerMapping bean = run.getBean(RequestMappingHandlerMapping.class);

        Map<RequestMappingInfo, HandlerMethod> handlerMethods = bean.getHandlerMethods();
        List<HandlerMethod> handlerMethodsForMappingName = bean.getHandlerMethodsForMappingName("");
        log.info("登录访问：http://127.0.0.1:8080/study/login.html");
    }
}
